package com.hu.zhcc.shiro.controller.xsf;

import com.hu.zhcc.shiro.entity.xsf.dto.TMealsDTO;
import com.hu.zhcc.shiro.entity.xsf.pojo.ChatInfo;
import com.hu.zhcc.shiro.entity.xsf.vo.TMealsVO;
import com.hu.zhcc.shiro.service.xsf.ChatInfoService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/chatInfo")
public class ChatInfoController {
    @Autowired
    private ChatInfoService chatInfoService;

    @GetMapping("")
    public List<ChatInfo> queryChatInfo(){
        List<ChatInfo> chatInfos = chatInfoService.queryInfoBySysId(1);
        return chatInfos;
    }

    @PostMapping("/{id}")
    public List<ChatInfo> queryChatInfoByMemberId(@PathVariable("id") int id){
        List<ChatInfo> chatInfos = chatInfoService.queryInfoByMemberId(id, 1);
        return chatInfos;
    }

    @PostMapping("")
    public int saveChatInfo(@RequestBody ChatInfo vo) {
        int i = chatInfoService.insertSelective(vo);
        return i;
    }

}
